const mysql = require('mysql');
const { MysqlConf } = require('../conf/db');

const connect = mysql.createConnection(MysqlConf);
connect.connect();

function exec(sql) {
  return new Promise((resolve, reject) => {
    connect.query(sql, (err, res) => {
      if(err) {
        reject(err);
      }
      resolve(res);
    });
  });
}

module.exports = exec;
